package com.alphaking.dao;

import org.springframework.stereotype.Repository;

import com.alphaking.model.User;
import com.alphaking.pojo.common.SearchBean;
import com.alphaking.pojo.common.SearchCondition;
@Repository
public class UserDao extends BaseDaoImpl<User> {
	
	/**
	 * 根据用户的openId获取用户
	 * @param openId
	 * @return
	 * @throws NoSuchFieldException
	 * @throws SecurityException
	 */
	public User getUserByOpenId(String openId) throws NoSuchFieldException, SecurityException {

		SearchCondition searchCondition = SearchCondition.addSearchBeanByMap(null,"userOpenid", SearchBean.OPERATOR_IN,openId,null);
	    User user =  this.getUniqueResult(searchCondition);
	    return user ;
	}
	
}
